Repository navigation
Keep the task instance in dag callbacks when its Dag version is missing - #72721
Merged
ephraimbuddy merged 3 commits intoSep 21, 2026
Merged
Conversation
ephraimbuddy
force-pushed
the
callback-ti-dag-version-fallback
branch
2 times, most recently
from
September 8, 2026 16:05
a7393ac to
8c2230e
Compare
kaxil
reviewed
Sep 9, 2026
ferruzzi
reviewed
Sep 9, 2026
ephraimbuddy
force-pushed
the
callback-ti-dag-version-fallback
branch
from
September 10, 2026 08:59
8c2230e to
a6c2887
Compare
kaxil
reviewed
Sep 10, 2026
ephraimbuddy
force-pushed
the
callback-ti-dag-version-fallback
branch
2 times, most recently
from
September 14, 2026 16:18
5c73b5e to
c91d07f
Compare
ferruzzi
approved these changes
Sep 18, 2026
ferruzzi
left a comment
Contributor
There was a problem hiding this comment.
Looks like everything has been addressed, thanks.
Since 3.3.0 the scheduler dropped a task instance with no dag_version_id from the callback context rather than crash on it, which cost users who emit tracing events from on_success_callback / on_failure_callback the ti they correlate each event on, leaving them no way to tie a callback back to its task. Handle a missing dag_version less destructively, so the callbacks receive the full task instance.
settings.Session is a scoped_session, so a defaulted session hands back the caller's own and then commits and closes it out from under them. Every production caller already holds a session, so the default bought nothing and only stood to end a transaction nobody asked to end.
One warning covered both stand-in tiers, so an ordinary Airflow 3 task instance whose run still has a version was reported to operators as a record predating Dag versioning. Both tiers also warned even though the callback receives its full context and nothing is lost; the sibling helper in the scheduler reserves warning for the case it cannot resolve. The tests covering the fallback let get_task_instance default its session, which committed and closed the fixture's own. The objects came back detached, so the flush never reached the database and no versionless row was ever under test.
ephraimbuddy
force-pushed
the
callback-ti-dag-version-fallback
branch
from
September 21, 2026 06:38
c91d07f to
9f189de
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Since 3.3.0 the scheduler dropped a task instance with no dag_version_id from the callback context rather than crash on it, which cost users who emit tracing events from on_success_callback / on_failure_callback the ti they correlate each event on, leaving them no way to tie a callback back to its task.
Handle a missing dag_version less destructively, so the callbacks receive the full task instance.
Was generative AI tooling used to co-author this PR?
Generated-by: Claude Opus 5 following the guidelines
{pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.